<template>
  <div class="table-page-search-wrapper">
    <a-form layout="inline" >
        <a-row :gutter="[24,40]">
          <a-col :xl="12" :lg="7" :md="12" :sm="24">
            <a-form-item label="项目名称">
              <a-input :max-length="255" :disabled="formDisabled" v-model="model.projectName"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="12" :lg="7" :md="12" :sm="24">
            <a-form-item label="项目编号" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input :disabled="formDisabled" v-model="model.projectFinalNo"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="12" :lg="7" :md="12" :sm="24">
            <a-form-item label="项目承接人" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input :disabled="formDisabled" v-model="model.undertakerName"></a-input>
            </a-form-item>
          </a-col>

          <a-col :xl="12" :lg="7" :md="12" :sm="24">
            <a-form-item label="经营团队" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input :disabled="formDisabled" v-model="model.teamName"/>
            </a-form-item>
          </a-col>

          <a-col :xl="12" :lg="7" :md="12" :sm="24">
            <a-form-item label="项目来源" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input :disabled="formDisabled" v-model="model.projectSource_dictText"/>
            </a-form-item>
          </a-col>

          <a-col :xl="12" :lg="7" :md="12" :sm="24">
            <a-form-item label="业主单位" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input :disabled="formDisabled" v-model="model.ownerUnitName"/>
            </a-form-item>
          </a-col>

          <a-col :xl="12" :lg="7" :md="12" :sm="24">
            <a-form-item label="签订单位" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input :disabled="formDisabled" v-model="model.signUnitName"/>
            </a-form-item>
          </a-col>
          <a-col :xl="12" :lg="7" :md="12" :sm="24">
            <a-form-item label="收款合同总额(元)" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input :readOnly="true" style="color: #1890FF;" v-model="model.collectContractAmountMoney" @click.prevent="getContractDetail(model.id)"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="12" :lg="7" :md="12" :sm="24">
            <a-form-item label="经营绩效(元)" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input disabled v-model="model.businessPerformance"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="12" :lg="7" :md="12" :sm="24">
            <a-form-item label="生产总绩效(元)" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input disabled v-model="model.totalProductPerformance"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="12" :lg="7" :md="12" :sm="24">
            <a-form-item label="已回款金额(元)" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input style="color: #1890FF;" :readOnly="true" v-model="model.realCollectionContractAmountMoney" @click.prevent="getContractDetail(model.id)"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="12" :lg="7" :md="12" :sm="24">
            <a-form-item label="付款合同总额(元)" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input :readOnly="true" style="color: #1890FF;" v-model="model.payContractAmountMoney" @click.prevent="getContractDetail(model.id)"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="12" :lg="7" :md="12" :sm="24">
            <a-form-item label="已付款金额(元)" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input style="color: #1890FF;" :readOnly="true" v-model="model.realPayContractAmountMoney" @click.prevent="getContractDetail(model.id)"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="12" :lg="7" :md="12" :sm="24">
            <a-form-item label="预算成本总额(元)" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input :readOnly="true" v-model="model.totalProjectBudget"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="12" :lg="7" :md="12" :sm="24">
            <a-form-item label="实际成本总额(元)" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input :readOnly="true" style="color: #1890FF;" v-model="model.costAmonut" @click.prevent="getReimbursementDetail(model.id)"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="12" :lg="7" :md="12" :sm="24">
            <a-form-item label="已完成进度" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input :readOnly="true" style="color: #1890FF;"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="12" :lg="7" :md="12" :sm="24">
            <a-form-item label="已确认收入" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input :readOnly="true" style="color: #1890FF;"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="12" :lg="7" :md="12" :sm="24">
            <a-form-item label="借款金额(元)" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input :readOnly="true" style="color: #1890FF;" v-model="model.loanAmount" @click.prevent="getLoanAmountDetail(model.id)"></a-input>
            </a-form-item>
          </a-col>
        </a-row>
      </a-form>
    <erp-project-finance-reimbursement-list ref="reimburForm" :projectId="model.id"></erp-project-finance-reimbursement-list>
    <erp-project-finance-loan-list ref="financeLoanForm"></erp-project-finance-loan-list>
  </div>
</template>

<script>
  import ErpProjectFinanceReimbursementList from './ErpProjectFinanceReimbursementList'
  import ErpProjectFinanceLoanList from './ErpProjectFinanceLoanList'
  import { mapGetters } from 'vuex';
  export default {
    name: 'ErpProjectReportInfoForm',
    props: ['formData'],
    components: {
      ErpProjectFinanceReimbursementList,
      ErpProjectFinanceLoanList
    },
    computed: {
      formDisabled() {
        return true
      },
    },
    watch: {
      formData: {
        handler (val) {
          
          this.model = val
        },
        immediate: true
      }
    },
    data () {
      return {
        confirmLoading: false,
        labelCol: {},
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 24 }
        },
        model: {},
        processUpdate: false,
        countNum: 0
      }
    },
    methods: {
      ...mapGetters(['userInfo']),
      getContractDetail(val) {
        this.$emit('goContract', val);
      },
      getReimbursementDetail(val) {
        this.$refs.reimburForm.initData(val);
        this.$refs.reimburForm.visible = true;
      },
      // 点击借款金额
      getLoanAmountDetail (val) {
        this.$refs.financeLoanForm.visible = true;
        this.$nextTick(() => {
          this.$refs.financeLoanForm.projectId = val
          this.$refs.financeLoanForm.loadData(1);
        })
        
      }
    }
  }
</script>

<style scoped>

</style>
